package com.zbs.framework.swagger.utils.logs;

import com.zbs.framework.swagger.utils.ApiTypeUtil;
import com.zbs.framework.swagger.utils.DateUtils;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class SysOperateLog implements Serializable {
    private Long operId;
 
    private String title;

    private String method;
 
    private String operName;
 
    private String operUrl;
 
    private String operIp;
 
    private String operLocation;
 
    private String toLocalIp;
 
    private Boolean status;
 
    private String errorMsg;

    private LocalDateTime operTime;
 
    private String operParam;

    private String requestType;

    private static final long serialVersionUID = 6318476463668087415L;
 
    public Long getOperId() {
        return operId;
    }
 
    public void setOperId(Long operId) {
        this.operId = operId;
    }
 
    public String getTitle() {
        return title;
    }
 
    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    public String getMethod() {
        return method;
    }
 
    public void setMethod(String method) {
        this.method = method == null ? null : method.trim();
    }

    public String getOperName() {
        return operName;
    }
 
    public void setOperName(String operName) {
        this.operName = operName == null ? null : operName.trim();
    }

    public String getOperUrl() {
        return operUrl;
    }
 
    public void setOperUrl(String operUrl) {
        this.operUrl = operUrl == null ? null : operUrl.trim();
    }
 
    public String getOperIp() {
        return operIp;
    }
 
    public void setOperIp(String operIp) {
        this.operIp = operIp == null ? null : operIp.trim();
    }
 
    public String getOperLocation() {
        return operLocation;
    }
 
    public void setOperLocation(String operLocation) {
        this.operLocation = operLocation == null ? null : operLocation.trim();
    }

    public Boolean getStatus() {
        return status;
    }
 
    public void setStatus(Boolean status) {
        this.status = status;
    }
 
    public String getErrorMsg() {
        return errorMsg;
    }
 
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg == null ? null : errorMsg.trim();
    }

    public LocalDateTime getOperTime() {
        return operTime;
    }
 
    public void setOperTime(LocalDateTime operTime) {
        this.operTime = operTime;
    }
 
    public String getOperParam() {
        return operParam;
    }
 
    public void setOperParam(String operParam) {
        this.operParam = operParam == null ? null : operParam.trim();
    }

    public String getRequestType() {
        return requestType;
    }

    public void setRequestType(String requestType) {
        this.requestType = requestType;
    }

    @Override
    public String toString() {
        return "{标题:'" + title + '\'' +
                ", 操作时间:" + operTime.format(DateTimeFormatter.ofPattern(DateUtils.FORMAT_LONG)) +
                ", 请求接口:'" + operUrl + '\'' +
                ", 方法:'" + method + '\'' +
                ", 操作人ip:'" + operIp + '\'' +
                ", 操作人所在地区:'" + operLocation + '\'' +
                ", 错误日志:'" + errorMsg + '\'' +
                ", 请求类型:'" + ApiTypeUtil.getRequestType(requestType) + '\'' +
                ", 请求参数:'" + operParam + '\'' +
                '}';
    }
}